'use strict';

const { Controller } = require('egg');

class MenuController extends Controller {
    async index() {
        const { ctx } = this;
        const res=await ctx.service.system.menu.index()
        ctx.helper.success(ctx,res)
    }
    async add() {
        const { ctx } = this;
        const res=await ctx.service.system.menu.add()
        ctx.helper.success(ctx,res)
    }
    async show() {
        const { ctx } = this;
        const res=await ctx.service.system.menu.show()
        ctx.helper.success(ctx,res)
    }
    async edit() {
        const { ctx } = this;
        const res=await ctx.service.system.menu.edit()
        ctx.helper.success(ctx,res)
    }
    async destroy() {
        const ctx = this.ctx;
        const res=await ctx.service.system.menu.destroy()
        ctx.helper.success(ctx,{data:{message:'删除成功'}});
    }
    async getParentMenu() {
        const { ctx } = this;
        const res=await ctx.service.system.menu.getParentMenu()

        ctx.helper.success(ctx,res)
    }
}

module.exports = MenuController;
